package com.beiding.jsonanalyzer.analyze.query;

/**
 * 连接词后
 * 可查自身,可查key
 *
 * @author 丁常磊
 * @date 2022/6/27 11:41
 */

public class NotOperator implements SelfQueryGrammar, KeyQueryGrammar, NotGrammar {

    private NodeQueryBuilder parent;

    public NotOperator(NodeQueryBuilder parent) {
        this.parent = parent;
    }

    @Override
    public NodeQueryBuilder getQueryBuilder() {

        //生成一个新的查询上下文 用于构建子条件
        return new NodeQueryBuilder();
    }

    @Override
    public NodeQueryBuilder embellish(NodeQueryBuilder nodeQueryBuilder) {
        //修饰为子条件
        return parent.addElement(new NotConditionFactory(nodeQueryBuilder));
    }
}
